package com.atguigu.lease.common.minio;

import io.minio.MinioClient;
import jakarta.annotation.Resource;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
//@EnableConfigurationProperties(Minioproperities.class)
@ConditionalOnProperty(name="minio.endpoint")
public class MinioConfiguration {
    @Resource
   private Minioproperities minioproperities;



    @Bean
    public MinioClient MinioClient(){
        MinioClient build = MinioClient.builder().endpoint(minioproperities.getEndPoint()).
                credentials(minioproperities.getAccessKey(), minioproperities.getSecretKey()).build();
        return build;
    }

}
